package com.zy.explore.common.infrastructure.result;

public class MessageRule {

    public static String build(Action action, Result result, String module) {
        return "[" + module + "]" + action.code + result.code;
    }

    public static String build(Action action, Result result, String module, String describe) {
        return "[" + module + "]" + action.code + describe + result.code;
    }

    public static String build(Result result, String module) {
        return module + result.code;
    }

    public static String build(Result result, String module, String describe) {
        return "[" + module + "]" + describe + result.code;
    }

    public enum Action {

        C("添加"),
        R("查询"),
        U("修改"),
        D("删除")
        ;

        private final String code;

        Action(String code) {
            this.code = code;
        }
    }

    public enum Result {
        success  ("成功"  ),
        fail     ("失败"  ),
        error    ("错误"  ),
        is_empty ("为空"  ),
        not_exist("不存在"),
        existed  ("已存在"),
        ;

        private final String code;

        Result(String code) {
            this.code = code;
        }
    }
}
